package com.syedu.day12.homework;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * description：
 * @author Administrator
 * @date 2022/3/31 13:52
 */
public class Poker {
    List<Card> cardList;

    /**
     * 利用构造方法初始化52张扑克牌
     */
    public Poker() {
        cardList = new ArrayList<>();
        //创建52个Card对象并且添加到集合中
        Card card;
        for (Suit suit : Suit.values()) {
            for (Rank rank : Rank.values()) {
                card = new Card(suit, rank);
                cardList.add(card);
            }
        }
    }

    public static void main(String[] args) {
        Poker poker = new Poker();
        List<Card> cardList = poker.cardList;
        //洗牌
        Collections.shuffle(cardList);
        //发牌
        cardList.forEach(System.out::println);
    }
}